/*
* @Author: smallcatX0
* @Date:   2017-12-01 16:00:08
* @Last Modified by:   smallcatX0
* @Last Modified time: 2017-12-01 16:25:13
*/

#include <stdio.h>
int words_num(char s[]){
    int i,flag=0,num=0;
    char c;
    for(i=0;(c=s[i])!='\0';i++) {
        if(c==' ') flag=0;
        else if(flag==0){
            flag=1;
            num++;
        }
    }
    return num;
}
int main() {
    char str[81];
    int num;
    printf("please input the string:\n");
    gets(str);
    num = words_num(str);
    printf("%d\n",num);
    return 0;
}